package com.zenchn.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/***
 * 处理状态 枚举
 * @author dingxinfa
 * @date 2018-12-03
 */
public enum HandleStatusEnum {

    /** 未处理 **/
    UNTREATED("未处理",0),
    /** 已处理 **/
    PROCESSED("已处理",1);


    /**名称**/
    private String name;
    /**值**/
    private Integer value;

    HandleStatusEnum(String name, Integer value){
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }


    /**
     * 获取 枚举值列表
     */
    public static List<Map> getList() {
        List<Map> valueList=new ArrayList<>();
        for (HandleStatusEnum inspectStatus : values()) {
            Map<String,Object> code=new HashMap<>(2);
            code.put("value",inspectStatus.getValue());
            code.put("name",inspectStatus.getName());
            valueList.add(code);
        }
        return valueList;
    }

    public static String getName(Integer value){
        for (HandleStatusEnum inspectStatus : values()) {
            Integer currValue=inspectStatus.getValue();
            if(currValue.equals(value)){
                return inspectStatus.getName();
            }
        }
        return "";
    }

}
